package com.smalljj.dao.impl;

import java.util.List;
import java.util.Map;

import com.smalljj.bean.Message;
import com.smalljj.dao.MessageDao;

public class MessageDaoImpl extends MiddleAbstractDao<Message> implements MessageDao {
	
	@Override
	protected Class<Message> getEntityClass() {
		return Message.class;
	}

	@Override
	public List<Map<String, Object>> getRMessageList(String userId) throws Exception {
		StringBuffer sql = new StringBuffer();
		sql.append(" select a.*,b.username from  message a ");
		sql.append(" left join user b on b.id =  a.auser ");
		sql.append(" where a.bdel=0 and  a.buser= "+userId);
		return super.findBySqlToMapList(sql.toString());
	}

	@Override
	public List<Map<String, Object>> getSMessageList(String userId) throws Exception {
		StringBuffer sql = new StringBuffer();
		sql.append(" select a.*,b.username from  message a ");
		sql.append(" left join user b on b.id =  a.buser ");
		sql.append(" where a.adel=0 and  a.auser= "+userId);
		return super.findBySqlToMapList(sql.toString());
	
	}
	
}
